package springAop.animotion;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;

/**
 * Created by mHandler on 2018/6/27 0027.
 * Description:
 */
@Aspect
public class MyAspect {

    @Before(value = "execution(public * springAop.animotion.CustomerDaoImpl.save())")
    public void before(){
        System.out.println("logging--------------");
    }

    @After(value = "MyAspect.fn()")
    public void log(){
        System.out.println("logging--------------");
    }

    @Around(value = "MyAspect.fn()")
    public void around(ProceedingJoinPoint proceedingJoinPoint){
        System.out.println("around1--------------");
        try {
            proceedingJoinPoint.proceed();
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
        System.out.println("around2--------------");
    }

    /**
     * 自定义切入点
     * */
    @Pointcut(value = "execution(public * springAop.animotion.CustomerDaoImpl.update())")
    public void fn(){

    }


}
